package com.example.my;

import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CoordinatorLayout layout=findViewById(R.id.layout);
        AlphaAnimation alphaAnimation=new AlphaAnimation(0f,1f);//一闪一闪的图片
        alphaAnimation.setDuration(1000);
        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationEnd(Animation animation) {
                jumpToMain();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {}
        });
        layout.startAnimation(alphaAnimation);
}

    private  void jumpToMain(){
        Intent intent=
                new Intent(MainActivity.this,Main2Activity.class);
        startActivity(intent);
        finish();
    }
}
